<template>
	<layout>
		<u-sticky bgColor="#fff">
			<u-search
				placeholder="搜索"
				:showAction="false"
				disabled
				@click="goSearch"
			></u-search>
			<u-tabs
				:list="tabsList"
				@change="onTabChange"
				:current="tabIndex"
			></u-tabs>
		</u-sticky>
		<p>收藏页面</p>
	</layout>
</template>

<script>
	export default {
		data() {
			return {
				tabsList: [],
				tabIndex: 0
			};
		},
		onLoad() {
			this.init()
		},
		methods: {
			// 初始化
			init() {
				this.getTabsList()
			},
			// 获取tabs列表
			getTabsList() {
				// 请求
				this.tabsList = [{id: 1, name: '今日推荐'},{id: 2, name: '排行榜'},{id: 3, name: '会员专属'},{id: 4, name: '早餐达人'},{id: 5, name: '新手不翻车'}]
			},
			goSearch() {
				uni.navigateTo({
					url: "/pages/search/search",
					animationType: "slide-in-top"
				})
			},
			onTabChange(tab) {
				console.log(tab);
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>
